282 PART 5 Looking for Relationships with Correlation and Regression

where ke is the elimination rate constant. ke is related to the elimination half-life (λ)

according to the formula:

0 693

.

/ ke, where 0.693 is the natural logarithm of 2.

So, if you can fit the preceding equation to your Conc-versus-Time data in

Table 19-2, you can estimate C 0, from which you can calculate Vd. You can also

estimate ke, from which you can calculate λ.

The preceding equation is nonlinear and includes parameters, withke appearing in

the exponent. Before nonlinear regression software became widely available, ana-

lysts would take a shortcut by shoehorning this nonlinear regression problem into

a straight-line regression by working with the logarithms of the concentrations.

But that approach can’t be generalized to handle more complicated equations that

often arise.

Running a nonlinear regression

Nonlinear curve-fitting is supported by many modern statistics packages, like

SPSS, SAS, GraphPad Prism, and R (see Chapter 4). It is possible (though not easy)

to set up calculations in Microsoft Excel. In addition, the web page http://

StatPages.info/nonlin.html can fit any function you can write involving up to

eight independent variables and up to eight parameters. Here are the steps we use

to do nonlinear regression in R:

1.

Create a vector of time data, and a vector of concentration data.

In R, you can develop arrays called vectors from data sets, but in this example,

we create each vector manually, naming them Time and Conc, using the data

from Table 19-2:

Time

c 0.25, 0.5, 1, 1.5, 2, 3, 4, 6, 8, 12

Conc

c 57.4, 54.0, 44.8, 52.7, 43.6, 40.1, 27.9, 20.6, 15

.0, 10.0

In the two preceding equations, c is a built-in R function for combine that

creates an array (see Chapter 2) as a vector from the lists of numbers.

2.

Specify the equation to be fitted to the data, using the algebraic syntax

your software requires.

We write the equation using R’s algebraic syntax this way: Conc ~ C0 * exp(– ke *

Time), where Conc and Time are your vectors of data, and C0 and ke are

parameters you set.

3.

Tell the software that C0 and ke are parameters to be fitted, and provide

initial estimates for these values.

Nonlinear curve-fitting is a complicated task solved by the software through

iteration. This means you give it some rough estimates, and it refines them into